package com.mxp.influx.client.job;

import com.mxp.influx.client.service.InfluxDBService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author maoxp
 * @date 2024-12-28 19:01
 */
@Slf4j
@Component
public class InfluxDBJob {
    @Resource
    private InfluxDBService influxDBService;

    @Value("${influx.disconnect.duration}")
    private Long duration;

    /**
     * 断开超时连接
     */
    @Scheduled(cron = "${influx.disconnect.cron}")
    public void disconnectInfluxDB() {
        log.info("断开超时连接...");
        influxDBService.disconnectOvertimeInfluxDB(duration);
    }
}
